package org.spark.api.config;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

/**
 * @author chenwy
 */
public enum HBaseInstance {

    /**
     * fast集群
     */
    FAST("hbase-fast-config.xml"),

    /**
     * huge
     */
    HUGE("hbase-huge-config.xml");

    HBaseInstance(String config) {

        Configuration conf = HBaseConfiguration.create();
        conf.addResource(config);
        this.configuration = conf;
        try {
            this.connection = ConnectionFactory.createConnection(conf);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private Configuration configuration;

    private Connection connection;

    public Configuration getConfiguration() {
        return configuration;
    }

    public Connection getConnection() {
        return connection;
    }


}
